<script language="JavaScript" type="text/javascript" src="<?=base_url();?>public/administrator/js/cart/product.js"></script>
<p>&nbsp;</p>
<form action="processProduct.php?action=addProduct" method="post"  name="frmListProduct" id="frmListProduct">
 <table width="100%" border="0" cellspacing="0" cellpadding="2" class="text">
  <tr>
   <td align="right">View products in : 
    <select name="cboCategory" class="box" id="cboCategory" onChange="viewProduct();">
     <option selected>All Category</option>
	<?php  foreach ($categoryList->result() as $row) { ?>
        <option value="<?php echo $row->cat_id;?>"><?php echo $row->cat_name;?></option>
		<?php } ?>
   </select>
   <script type="text/javascript">
    document.getElementById("cboCategory").value="<?php echo $catId;?>"
   </script>
 </td>
 </tr>
</table>
<br>
 <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="text">
  <tr align="center" id="listTableHeader"> 
   <td>Product Name</td>
   <td width="75">Thumbnail</td>
   <td width="75">Category</td>
   <td width="70">Modify</td>
   <td width="70">Delete</td>
  </tr>
  <?php
$parentId = 0;
if ($query->num_rows() > 0) {
	$i = 0;
	
	 foreach ($query->result() as $row) {
		if ($row->pd_thumbnail) {
			$row->pd_thumbnail = base_url() . 'public/picture/product/' . $row->pd_thumbnail;
		} else {
			$row->pd_thumbnail =base_url() . 'public/picture/product/'. 'images/no-image-small.png';
		}	
		
		
		
		if ($i%2) {
			$class = 'row1';
		} else {
			$class = 'row2';
		}
		
		$i += 1;
?>
  <tr class=""> 
   <td><a href="index.php?view=detail&productId=<?php echo $row->pd_id; ?>"><?php echo $row->pd_name; ?></a></td>
   <td width="75" align="center"><img src="<?php echo $row->pd_thumbnail; ?>"></td>
   <td width="75" align="center"><a href="?c=<?php echo $row->cat_id; ?>"><?php echo $row->cat_name; ?></a></td>
   <td width="70" align="center"><a href="javascript:modifyProduct(<?php echo $row->pd_id; ?>);">Modify</a></td>
   <td width="70" align="center"><a href="javascript:deleteProduct(<?php echo $row->pd_id; ?>, <?php echo $row->cat_id; ?>);">Delete</a></td>
  </tr>
  <?php
	} // end while
?>
  <tr> 
   <td colspan="5" align="center">
   </td>
  </tr>
<?php	
} else {
?>
  <tr> 
   <td colspan="5" align="center">No Products Yet</td>
  </tr>
  <?php
}
?>
  <tr> 
   <td colspan="5">&nbsp;</td>
  </tr>
  <tr> 
   <td colspan="5" align="right"><input name="btnAddProduct" type="button" id="btnAddProduct" value="Add Product" class="box" onClick="addProduct(<?php echo $catId;?>)"></td>
  </tr>
 </table>
 <p>&nbsp;</p>
</form>